USE [NGroup_VTL_DB]
GO

/****** Object:  StoredProcedure [dbo].[GetProductDetail]    Script Date: 9/16/2014 9:24:15 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


-- =============================================
-- Author:		Bui Thanh Nam
-- Create date: 20140916
-- Description:	Get product's Detail by unique string
-- =============================================
CREATE PROCEDURE [dbo].[GetProductDetailForEdit]
	@ParentTypeID		INT,
	@ChildTypeID		INT,
	@UniqueString		NVARCHAR(500)
AS
BEGIN

	SET NOCOUNT ON;

	SELECT 
		   [dbo].[Products].[Title_En] 
		  ,[dbo].[Products].[Title]
		  ,[dbo].[Products].[Content_En] 
		  ,[dbo].[Products].[Content]
		  ,[dbo].[Products].[ProductDetail_En]
		  ,[dbo].[Products].[ProductDetail]
		  ,[dbo].[Products].[ImageSmallURL_En] 
		  ,[dbo].[Products].[ImageSmallURL]
		  ,[dbo].[Products].[ImageLargeURL_En]
		  ,[dbo].[Products].[ImageLargeURL]
		  ,[dbo].[Products].[MetaContent_En]
		  ,[dbo].[Products].[MetaContent]
		  ,[dbo].[Products].[Price_En] 
		  ,[dbo].[Products].[Price]
		  ,[dbo].[Products].[ID]			  
		  ,[dbo].[Products].[UniqueString]
		  ,[dbo].[Products].[HomePageDisplayBlockID]
		  ,[dbo].[Products].[TypeID]
		  ,[dbo].[Products].[SupTypeID]		  
		  ,[dbo].[Products].[DeliveryDetail]		 
		  ,[dbo].[Products].[CreatedAt]
		  ,[dbo].[Products].[CreatedBy]
		  ,[dbo].[Products].[LastUpdatedAt]
		  ,[dbo].[Products].[LastUpdatedBy]		  
	FROM [dbo].[Products] WITH (NOLOCK) INNER JOIN [dbo].[GenericTypes] WITH (NOLOCK)
				ON [dbo].[Products].[TypeID] = [dbo].[GenericTypes].[ID]
	WHERE [dbo].[Products].[UniqueString] = @UniqueString
	AND [dbo].[Products].[TypeID] = @ChildTypeID
	AND [dbo].[Products].[SupTypeID] = @ParentTypeID
	AND [dbo].[Products].[IsActive] <> 0		
	AND [dbo].[GenericTypes].[IsActive] <> 0
END




GO


